﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CE.User;
using CE.Global;
using CE.Provider;


public partial class Provider_TravelInsurance_ViewProviderTravelInsurance : System.Web.UI.Page
{
    string PageName = "CXTI";
    string SubPageName = "CXTICT";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] == null || Session[CE.Global.General.ProviderCompanyId] == null)
        {
            Response.Redirect("~/Provider/ProviderSecureLogin.aspx");
        }
        CheckMainPageAccess();
        CheckSubPageAccess();

        if (!IsPostBack)
        {
            txtProviderComId.Text = Session[CE.Global.General.ProviderCompanyId].ToString();
        }
        
    }

    protected void GetProvider()
    {
        //ddlTI
    }

    //protected void grvTADetails_RowDataBound(Object src, GridViewRowEventArgs e)
    //{
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
    //        if (e.Row.Cells[4].Text == "STD")
    //            e.Row.Cells[4].Text = "Standard Cover";
    //        else if (e.Row.Cells[4].Text == "MED")
    //            e.Row.Cells[4].Text = "Medium Cover";
    //        else
    //            e.Row.Cells[4].Text = "High Cover";

    //    }
    //}

    protected void ibtBack_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("~/Provider/TravelInsurance/TravelInsuranceHome.aspx");
    }

    private void CheckMainPageAccess()
    {
        Int64 PageAccess = General.GetProviderMainPageAccess(Convert.ToInt64(Session[General.ProviderCompanyId].ToString()),
                                                        Convert.ToInt64(Session[General.UserId].ToString()), PageName);
        if (PageAccess == 0)
        {
            //Response.Redirect("~/Provider/UserMessage.aspx?errorcode=2000");
            Response.Redirect("~/Provider/UserMessage.aspx?mt=UM&ec=2000");
        }
    }

    private void CheckSubPageAccess()
    {
        Int64 PageAccess = General.GetProviderSubPageAccess(Convert.ToInt64(Session[General.ProviderCompanyId].ToString()),
                                                        Convert.ToInt64(Session[General.UserId].ToString()), SubPageName);
        if (PageAccess == 0)
        {
            //Response.Redirect("~/Provider/UserMessage.aspx?errorcode=2000");
            Response.Redirect("~/Provider/UserMessage.aspx?mt=UM&ec=2000");
        }
        else if (PageAccess == 100)
        {
            lnkNewClaimInfo.Visible = false;
        }
    }

}
